using System;
using System.Collections.Generic;
using System.Text;

namespace Engine.IO
{
    public class FileSizeFormatter:IFormatProvider, ICustomFormatter
    {
        public object GetFormat(System.Type type)
        {
            return this;
        }
        public string Format(string format, object arg, IFormatProvider formatProvider)
        {
            if(arg != null && arg != System.DBNull.Value)
            {
                return FileTools.GetSize(long.Parse(arg.ToString()));
            }
            return "0";
        }
    }
}
